<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const p = new Promise((resolve, reject) => {
            setTimeout(() => {
                const time = Date.now()
                if (time % 2 == 0) {
                    resolve("成功数据 time" + time)
                } else {
                    reject("成功数据 time" + time)
                }
            }, 1000)
        })
        p.then(
            value => {
                console.log("回调成功", value)
            },
            reason => {
                console.log("回调失败", reason)
            }
        )
    </script>
</body>

</html>